<template>
  <h1>事件绑定指令</h1>
  <!-- @click是v-on:click的简写 效果等价-->
  <button @click="f">按钮1</button>
  <button v-on:click="f">按钮2</button>
  <hr>
  <h3>敲回车事件</h3>
  <input type="text" placeholder="请输入你想搜索的关键字" v-model="search" @keydown.enter="ent">
</template>

<script setup>
  import {ref} from "vue";

  const f = ()=>{
    alert('点击了');
  };
  const search = ref("");
  const ent = ()=>{
    alert("您想搜索的是"+search.value+'吗？')
  };
</script>


<style scoped>

</style>